<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Prawnto::TemplateHandler::CompileSupport</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Prawnto::TemplateHandler::CompileSupport</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/prawnto/lib/prawnto/template_handler/compile_support_rb.html">
                vendor/plugins/prawnto/lib/prawnto/template_handler/compile_support.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000007">ie_request?</a>&nbsp;&nbsp;
      <a href="#M000004">new</a>&nbsp;&nbsp;
      <a href="#M000005">pull_options</a>&nbsp;&nbsp;
      <a href="#M000010">set_cache_control</a>&nbsp;&nbsp;
      <a href="#M000011">set_content_type</a>&nbsp;&nbsp;
      <a href="#M000012">set_disposition</a>&nbsp;&nbsp;
      <a href="#M000006">set_headers</a>&nbsp;&nbsp;
      <a href="#M000009">set_pragma</a>&nbsp;&nbsp;
      <a href="#M000008">ssl_request?</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">options</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc">
extend ActiveSupport::Memoizable

</td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000004" class="method-detail">
        <a name="M000004"></a>

        <div class="method-heading">
          <a href="#M000004" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(controller)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000004-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000004-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/prawnto/lib/prawnto/template_handler/compile_support.rb, line 9</span>
 9:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">controller</span>)
10:         <span class="ruby-ivar">@controller</span> = <span class="ruby-identifier">controller</span>
11:         <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">pull_options</span>
12:         <span class="ruby-identifier">set_headers</span>
13:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000007" class="method-detail">
        <a name="M000007"></a>

        <div class="method-heading">
          <a href="#M000007" class="method-signature">
          <span class="method-name">ie_request?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
TODO: kept around from railspdf&#8212; maybe not needed anymore? should
check.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000007-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/prawnto/lib/prawnto/template_handler/compile_support.rb, line 27</span>
27:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ie_request?</span>
28:         <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">env</span>[<span class="ruby-value str">'HTTP_USER_AGENT'</span>] <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/msie/i</span>
29:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000005" class="method-detail">
        <a name="M000005"></a>

        <div class="method-heading">
          <a href="#M000005" class="method-signature">
          <span class="method-name">pull_options</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000005-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000005-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/prawnto/lib/prawnto/template_handler/compile_support.rb, line 15</span>
15:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pull_options</span>
16:         <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">send</span> <span class="ruby-identifier">:compute_prawnto_options</span> <span class="ruby-operator">||</span> {}
17:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000010" class="method-detail">
        <a name="M000010"></a>

        <div class="method-heading">
          <a href="#M000010" class="method-signature">
          <span class="method-name">set_cache_control</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
TODO: kept around from railspdf&#8212; maybe not needed anymore? should
check.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000010-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000010-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/prawnto/lib/prawnto/template_handler/compile_support.rb, line 48</span>
48:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_cache_control</span>
49:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ssl_request?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">ie_request?</span>
50:           <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Cache-Control'</span>] = <span class="ruby-value str">'maxage=1'</span> <span class="ruby-comment cmt"># added to make ie ssl pdfs work (per naisayer)</span>
51:         <span class="ruby-keyword kw">else</span>
52:           <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Cache-Control'</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">ie_request?</span> <span class="ruby-value">? </span><span class="ruby-value str">'no-cache, must-revalidate'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">''</span>
53:         <span class="ruby-keyword kw">end</span>
54:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000011" class="method-detail">
        <a name="M000011"></a>

        <div class="method-heading">
          <a href="#M000011" class="method-signature">
          <span class="method-name">set_content_type</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000011-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000011-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/prawnto/lib/prawnto/template_handler/compile_support.rb, line 56</span>
56:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_content_type</span>
57:         <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">content_type</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">Mime</span><span class="ruby-operator">::</span><span class="ruby-constant">PDF</span>
58:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000012" class="method-detail">
        <a name="M000012"></a>

        <div class="method-heading">
          <a href="#M000012" class="method-signature">
          <span class="method-name">set_disposition</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000012-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000012-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/prawnto/lib/prawnto/template_handler/compile_support.rb, line 60</span>
60:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_disposition</span>
61:         <span class="ruby-identifier">inline</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:inline</span>] <span class="ruby-operator">?</span> <span class="ruby-value str">'inline'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'attachment'</span>
62:         <span class="ruby-identifier">filename</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:filename</span>] <span class="ruby-operator">?</span> <span class="ruby-node">&quot;filename=#{options[:filename]}&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">nil</span>
63:         <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;Content-Disposition&quot;</span>] = [<span class="ruby-identifier">inline</span>,<span class="ruby-identifier">filename</span>].<span class="ruby-identifier">compact</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">';'</span>)
64:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000006" class="method-detail">
        <a name="M000006"></a>

        <div class="method-heading">
          <a href="#M000006" class="method-signature">
          <span class="method-name">set_headers</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000006-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/prawnto/lib/prawnto/template_handler/compile_support.rb, line 19</span>
19:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_headers</span>
20:         <span class="ruby-identifier">set_pragma</span>
21:         <span class="ruby-identifier">set_cache_control</span>
22:         <span class="ruby-identifier">set_content_type</span>
23:         <span class="ruby-identifier">set_disposition</span>
24:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000009" class="method-detail">
        <a name="M000009"></a>

        <div class="method-heading">
          <a href="#M000009" class="method-signature">
          <span class="method-name">set_pragma</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
TODO: kept around from railspdf&#8212; maybe not needed anymore? should
check.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000009-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/prawnto/lib/prawnto/template_handler/compile_support.rb, line 39</span>
39:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_pragma</span>
40:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ssl_request?</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">ie_request?</span>
41:           <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Pragma'</span>] = <span class="ruby-value str">'public'</span> <span class="ruby-comment cmt"># added to make ie ssl pdfs work (per naisayer)</span>
42:         <span class="ruby-keyword kw">else</span>
43:           <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">headers</span>[<span class="ruby-value str">'Pragma'</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">ie_request?</span> <span class="ruby-value">? </span><span class="ruby-value str">'no-cache'</span> <span class="ruby-operator">:</span> <span class="ruby-value str">''</span>
44:         <span class="ruby-keyword kw">end</span>
45:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000008" class="method-detail">
        <a name="M000008"></a>

        <div class="method-heading">
          <a href="#M000008" class="method-signature">
          <span class="method-name">ssl_request?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
added to make ie happy with ssl pdf&#8216;s (per naisayer)
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000008-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/prawnto/lib/prawnto/template_handler/compile_support.rb, line 33</span>
33:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ssl_request?</span>
34:         <span class="ruby-ivar">@controller</span>.<span class="ruby-identifier">request</span>.<span class="ruby-identifier">env</span>[<span class="ruby-value str">'SERVER_PROTOCOL'</span>].<span class="ruby-identifier">downcase</span> <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;https&quot;</span>
35:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>